
kmpkg_from_gitee(
        OUT_SOURCE_PATH SOURCE_PATH
        REPO kumo-pub/krpc
        REF "v${VERSION}"
        SHA512 d509a9a618d1926a5e21d4772037ce7fb0caf8a6cfcef67026eda8c1000236104101925f4e6f7cc2d4b2b5f58cb1653f6795e89bd9eb66bb3646de8a641174fd
        HEAD_REF master
)

kmpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
        FEATURES
        tools BUILD_RPC_TOOLS
        )

kmpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}"
    DISABLE_PARALLEL_CONFIGURE
    OPTIONS
        ${FEATURE_OPTIONS}
        -DKMCMAKE_BUILD_TEST=OFF
        -DWITH_THRIFT=OFF
)

kmpkg_cmake_install()
kmpkg_cmake_config_fixup(PACKAGE_NAME krpc CONFIG_PATH lib/cmake/krpc)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/krpc/tools")

kmpkg_copy_pdbs()

kmpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

kmpkg_fixup_pkgconfig()
kmpkg_copy_tools(TOOL_NAMES  protoc-gen-mcpack AUTO_CLEAN)
if (BUILD_RPC_TOOLS)
    kmpkg_copy_tools(TOOL_NAMES  krpc AUTO_CLEAN)
endif ()
